from django.urls import path, include
from rest_framework.routers import DefaultRouter
from rest_framework_nested import routers
from . import views

router = DefaultRouter()
router.register(r'patients', views.PatientViewSet)
router.register(r'diagnoses', views.DiagnosisHistoryViewSet)
router.register(r'diagnosis-history', views.DiagnosisHistoryViewSet, basename='diagnosis-history')
router.register(r'doctor/actions', views.DoctorActionsViewSet, basename='doctor-actions')

# 创建嵌套路由
patients_router = routers.NestedDefaultRouter(router, r'patients', lookup='patient')
patients_router.register(r'diagnoses', views.DiagnosisHistoryViewSet, basename='patient-diagnoses')

urlpatterns = [
    path('', include(router.urls)),
    path('', include(patients_router.urls)),
    # 医生操作相关的API
    path('doctor/actions/dashboard-stats/', views.dashboard_stats, name='dashboard-stats'),
    path('doctor/actions/waiting-patients/', views.waiting_patients, name='waiting-patients'),
    path('doctor/actions/call-patient/<int:patient_id>/', views.call_patient, name='call-patient'),
    path('doctor/actions/treat-patient/<int:patient_id>/', views.treat_patient, name='treat-patient'),
    path('doctor/actions/save-diagnosis/', views.save_diagnosis, name='save-diagnosis'),
    path('doctor/actions/patient-diagnoses/<int:patient_id>/', views.patient_diagnoses, name='patient-diagnoses'),
] 